# Lua RIBClient
PROJECT (LuaRIBClient)

IF (WIN32)
  SET (CMAKE_BUILD_TYPE "Release")
ENDIF (WIN32)

FIND_PACKAGE(Lua50)
INCLUDE_DIRECTORIES(${LUA_INCLUDE_PATH})

INCLUDE_DIRECTORIES ( . )
INCLUDE_DIRECTORIES ( ../utils )
INCLUDE_DIRECTORIES ( $ENV{CPPUNIT_ROOT}/include )
INCLUDE_DIRECTORIES ( $ENV{OPENEXR_ROOT}/include )
INCLUDE_DIRECTORIES ( $ENV{ILMBASE_ROOT}/include )
INCLUDE_DIRECTORIES ( $ENV{LUA_INCLUDE} )

LINK_DIRECTORIES ( $ENV{CPPUNIT_ROOT}/lib )
LINK_DIRECTORIES ( $ENV{OPENEXR_ROOT}/lib )
LINK_DIRECTORIES ( $ENV{ILMBASE_ROOT}/lib )

SET(CMAKE_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/lua)
SET_SOURCE_FILES_PROPERTIES( RIBClient.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES( RIBClient.i PROPERTIES CMAKE_SWIG_FLAGS "-includeall -o RIBClientLUA_wrap.cxx")

SWIG_ADD_MODULE ( ribclient lua RIBClient.i ParameterList.cpp )
SWIG_LINK_LIBRARIES ( ribclient ${RIBCLIENT_LIBRARIES} utils ${LUA_LIBRARIES} )

IF (WIN32)
  SET_TARGET_PROPERTIES ( ribclient PROPERTIES SUFFIX ".pyd")
ENDIF (WIN32)

INSTALL ( TARGETS ribclient
  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX})

INSTALL ( FILES ${CMAKE_BINARY_DIR}/lua/ribclient.py
  DESTINATION ${CMAKE_INSTALL_PREFIX})

IF (WIN32)
  SET ( CPACK_GENERATOR "ZIP" )
ENDIF (WIN32)
INCLUDE (CPack)
